﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate.Mappings;

namespace Apollo
{
    [NHibernateEntity(Table = "apl_EntityProperties")]
    public class EntityProperty
    {
        public EntityProperty() { }

        [PrimaryKey]
        public virtual int Id { get; set; }

        [Property]
        public virtual string PropertyName { get; set; }

        [BelongsTo(Column = "ID_Entity")]
        public virtual Entity Entity { get; set; }

        [Property]
        public virtual EntityPropertyType Type { get; set; }

        [Property]
        public virtual string FormatString { get; set; }

        [BelongsTo(Column = "ID_BelongTo_Entity")]
        public virtual Entity BelongToEntity { get; set; }

        [BelongsTo(Column = "ID_Custom_EntityView")]
        public virtual EntityView CustomView { get; set; }

        [BelongsTo(Column = "ID_ReverseRelationList_EntityView")]
        public virtual EntityView ReverseRelationListView { get; set; }

        [BelongsTo(Column = "ID_ReverseRelationItem_EntityView")]
        public virtual EntityView ReverseRelationItemView { get; set; }

        [BelongsTo(Column = "ID_Enum")]
        public virtual Enum Enum { get; set; }
        
        [Property]
        public virtual string DefaultValue { get; set; }
    }

    public enum EntityPropertyType { 
        Normal = 1,
        Relation = 2,
        Enum = 3
    }
}
